nethackfandomcom-20200214-history
Source:NetHack 3.4.0/youprop.h
Below is the full text to youprop.h from the source code of NetHack 3.4.0. To link to a particular line, write [[NetHack 3.4.0/youprop.h#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)youprop.h 3.4 1999/07/02 */ 2. /* Copyright © 1989 Mike Threepoint */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #ifndef YOUPROP_H 6. #define YOUPROP_H 7. 8. #include "prop.h" 9. #include "permonst.h" 10. #include "mondata.h" 11. #include "pm.h" 12. 13. 14. /* KMH, intrinsics patch. 15. * Reorganized and rewritten for >32-bit properties. 16. * HXxx refers to intrinsic bitfields while in human form. 17. * EXxx refers to extrinsic bitfields from worn objects. 18. * BXxx refers to the cause of the property being blocked. 19. * Xxx refers to any source, including polymorph forms. 20. */ 21. 22. 23. #define maybe_polyd(if_so,if_not) (Upolyd ? (if_so) : (if_not)) 24. 25. 26. /*** Resistances to troubles ***/ 27. /* With intrinsics and extrinsics */ 28. #define HFire_resistance u.upropsFIRE_RES.intrinsic 29. #define EFire_resistance u.upropsFIRE_RES.extrinsic 30. #define Fire_resistance (HFire_resistance || EFire_resistance || \ 31. resists_fire(&youmonst)) 32. 33. #define HCold_resistance u.upropsCOLD_RES.intrinsic 34. #define ECold_resistance u.upropsCOLD_RES.extrinsic 35. #define Cold_resistance (HCold_resistance || ECold_resistance || \ 36. resists_cold(&youmonst)) 37. 38. #define HSleep_resistance u.upropsSLEEP_RES.intrinsic 39. #define ESleep_resistance u.upropsSLEEP_RES.extrinsic 40. #define Sleep_resistance (HSleep_resistance || ESleep_resistance || \ 41. resists_sleep(&youmonst)) 42. 43. #define HDisint_resistance u.upropsDISINT_RES.intrinsic 44. #define EDisint_resistance u.upropsDISINT_RES.extrinsic 45. #define Disint_resistance (HDisint_resistance || EDisint_resistance || \ 46. resists_disint(&youmonst)) 47. 48. #define HShock_resistance u.upropsSHOCK_RES.intrinsic 49. #define EShock_resistance u.upropsSHOCK_RES.extrinsic 50. #define Shock_resistance (HShock_resistance || EShock_resistance || \ 51. resists_elec(&youmonst)) 52. 53. #define HPoison_resistance u.upropsPOISON_RES.intrinsic 54. #define EPoison_resistance u.upropsPOISON_RES.extrinsic 55. #define Poison_resistance (HPoison_resistance || EPoison_resistance || \ 56. resists_poison(&youmonst)) 57. 58. #define HDrain_resistance u.upropsDRAIN_RES.intrinsic 59. #define EDrain_resistance u.upropsDRAIN_RES.extrinsic 60. #define Drain_resistance (HDrain_resistance || EDrain_resistance || \ 61. resists_drli(&youmonst)) 62. 63. /* Intrinsics only */ 64. #define HSick_resistance u.upropsSICK_RES.intrinsic 65. #define Sick_resistance (HSick_resistance || \ 66. youmonst.data->mlet S_FUNGUS || \ 67. youmonst.data &monsPM_GHOUL || \ 68. defends(AD_DISE,uwep)) 69. #define Invulnerable u.upropsINVULNERABLE.intrinsic /* Tom */ 70. 71. /* Extrinsics only */ 72. #define EAntimagic u.upropsANTIMAGIC.extrinsic 73. #define Antimagic (EAntimagic || \ 74. (Upolyd && resists_magm(&youmonst))) 75. 76. #define EAcid_resistance u.upropsACID_RES.extrinsic 77. #define Acid_resistance (EAcid_resistance || resists_acid(&youmonst)) 78. 79. #define EStone_resistance u.upropsSTONE_RES.extrinsic 80. #define Stone_resistance (EStone_resistance || resists_ston(&youmonst)) 81. 82. 83. /*** Troubles ***/ 84. /* Pseudo-property */ 85. #define Punished (uball) 86. 87. /* Those implemented solely as timeouts (we use just intrinsic) */ 88. #define HStun u.upropsSTUNNED.intrinsic 89. #define Stunned (HStun || u.umonnum PM_STALKER || \ 90. youmonst.data->mlet S_BAT) 91. /* Note: birds will also be stunned */ 92. 93. #define HConfusion u.upropsCONFUSION.intrinsic 94. #define Confusion HConfusion 95. 96. #define Blinded u.upropsBLINDED.intrinsic 97. #define Blindfolded (ublindf && ublindf->otyp != LENSES) 98. /* ...means blind because of a cover */ 99. #define Blind ((Blinded || Blindfolded || !haseyes(youmonst.data)) && \ 100. !(ublindf && ublindf->oartifact ART_EYES_OF_THE_OVERWORLD)) 101. /* ...the Eyes operate even when you really are blind 102. or don't have any eyes */ 103. 104. #define Sick u.upropsSICK.intrinsic 105. #define Stoned u.upropsSTONED.intrinsic 106. #define Strangled u.upropsSTRANGLED.intrinsic 107. #define Vomiting u.upropsVOMITING.intrinsic 108. #define Glib u.upropsGLIB.intrinsic 109. #define Slimed u.upropsSLIMED.intrinsic /* Tom */ 110. 111. /* Hallucination is solely a timeout; its resistance is extrinsic */ 112. #define HHallucination u.upropsHALLUC.intrinsic 113. #define EHalluc_resistance u.upropsHALLUC_RES.extrinsic 114. #define Halluc_resistance (EHalluc_resistance || \ 115. (Upolyd && dmgtype(youmonst.data, AD_HALU))) 116. #define Hallucination (HHallucination && !Halluc_resistance) 117. 118. /* Timeout, plus a worn mask */ 119. #define HFumbling u.upropsFUMBLING.intrinsic 120. #define EFumbling u.upropsFUMBLING.extrinsic 121. #define Fumbling (HFumbling || EFumbling) 122. 123. #define HWounded_legs u.upropsWOUNDED_LEGS.intrinsic 124. #define EWounded_legs u.upropsWOUNDED_LEGS.extrinsic 125. #define Wounded_legs (HWounded_legs || EWounded_legs) 126. 127. #define HSleeping u.upropsSLEEPING.intrinsic 128. #define ESleeping u.upropsSLEEPING.extrinsic 129. #define Sleeping (HSleeping || ESleeping) 130. 131. #define HHunger u.upropsHUNGER.intrinsic 132. #define EHunger u.upropsHUNGER.extrinsic 133. #define Hunger (HHunger || EHunger) 134. 135. 136. /*** Vision and senses ***/ 137. #define HSee_invisible u.upropsSEE_INVIS.intrinsic 138. #define ESee_invisible u.upropsSEE_INVIS.extrinsic 139. #define See_invisible (HSee_invisible || ESee_invisible || \ 140. perceives(youmonst.data)) 141. 142. #define HTelepat u.upropsTELEPAT.intrinsic 143. #define ETelepat u.upropsTELEPAT.extrinsic 144. #define Blind_telepat (HTelepat || ETelepat || \ 145. telepathic(youmonst.data)) 146. #define Unblind_telepat (ETelepat) 147. 148. #define HWarning u.upropsWARNING.intrinsic 149. #define EWarning u.upropsWARNING.extrinsic 150. #define Warning (HWarning || EWarning) 151. 152. /* Warning for a specific type of monster */ 153. #define HWarn_of_mon u.upropsWARN_OF_MON.intrinsic 154. #define EWarn_of_mon u.upropsWARN_OF_MON.extrinsic 155. #define Warn_of_mon (HWarn_of_mon || EWarn_of_mon) 156. 157. #define HUndead_warning u.upropsWARN_UNDEAD.intrinsic 158. #define Undead_warning (HUndead_warning) 159. 160. #define HSearching u.upropsSEARCHING.intrinsic 161. #define ESearching u.upropsSEARCHING.extrinsic 162. #define Searching (HSearching || ESearching) 163. 164. #define HClairvoyant u.upropsCLAIRVOYANT.intrinsic 165. #define EClairvoyant u.upropsCLAIRVOYANT.extrinsic 166. #define BClairvoyant u.upropsCLAIRVOYANT.blocked 167. #define Clairvoyant ((HClairvoyant || EClairvoyant) &&\ 168. !BClairvoyant) 169. 170. #define HInfravision u.upropsINFRAVISION.intrinsic 171. #define EInfravision u.upropsINFRAVISION.extrinsic 172. #define Infravision (HInfravision || EInfravision || \ 173. infravision(youmonst.data)) 174. 175. #define HDetect_monsters u.upropsDETECT_MONSTERS.intrinsic 176. #define EDetect_monsters u.upropsDETECT_MONSTERS.extrinsic 177. #define Detect_monsters (HDetect_monsters || EDetect_monsters) 178. 179. 180. /*** Appearance and behavior ***/ 181. #define Adornment u.upropsADORNED.extrinsic 182. 183. #define HInvis u.upropsINVIS.intrinsic 184. #define EInvis u.upropsINVIS.extrinsic 185. #define BInvis u.upropsINVIS.blocked 186. #define Invis ((HInvis || EInvis || \ 187. pm_invisible(youmonst.data)) && !BInvis) 188. #define Invisible (Invis && !See_invisible) 189. /* Note: invisibility also hides inventory and steed */ 190. 191. #define EDisplaced u.upropsDISPLACED.extrinsic 192. #define Displaced EDisplaced 193. 194. #define HStealth u.upropsSTEALTH.intrinsic 195. #define EStealth u.upropsSTEALTH.extrinsic 196. #define BStealth u.upropsSTEALTH.blocked 197. #define Stealth ((HStealth || EStealth) && !BStealth) 198. 199. #define HAggravate_monster u.upropsAGGRAVATE_MONSTER.intrinsic 200. #define EAggravate_monster u.upropsAGGRAVATE_MONSTER.extrinsic 201. #define Aggravate_monster (HAggravate_monster || EAggravate_monster) 202. 203. #define HConflict u.upropsCONFLICT.intrinsic 204. #define EConflict u.upropsCONFLICT.extrinsic 205. #define Conflict (HConflict || EConflict) 206. 207. 208. /*** Transportation ***/ 209. #define HJumping u.upropsJUMPING.intrinsic 210. #define EJumping u.upropsJUMPING.extrinsic 211. #define Jumping (HJumping || EJumping) 212. 213. #define HTeleportation u.upropsTELEPORT.intrinsic 214. #define ETeleportation u.upropsTELEPORT.extrinsic 215. #define Teleportation (HTeleportation || ETeleportation || \ 216. can_teleport(youmonst.data)) 217. 218. #define HTeleport_control u.upropsTELEPORT_CONTROL.intrinsic 219. #define ETeleport_control u.upropsTELEPORT_CONTROL.extrinsic 220. #define Teleport_control (HTeleport_control || ETeleport_control || \ 221. control_teleport(youmonst.data)) 222. 223. #define HLevitation u.upropsLEVITATION.intrinsic 224. #define ELevitation u.upropsLEVITATION.extrinsic 225. #define Levitation (HLevitation || ELevitation || \ 226. is_floater(youmonst.data)) 227. /* Can't touch surface, can't go under water; overrides all others */ 228. #define Lev_at_will (((HLevitation & I_SPECIAL) != 0L || \ 229. (ELevitation & W_ARTI) != 0L) && \ 230. (HLevitation & ~(I_SPECIAL|TIMEOUT)) 0L && \ 231. (ELevitation & ~W_ARTI) 0L && \ 232. !is_floater(youmonst.data)) 233. 234. #define EFlying u.upropsFLYING.extrinsic 235. #ifdef STEED 236. # define Flying (EFlying || is_flyer(youmonst.data) || \ 237. (u.usteed && is_flyer(u.usteed->data))) 238. #else 239. # define Flying (EFlying || is_flyer(youmonst.data)) 240. #endif 241. /* May touch surface; does not override any others */ 242. 243. #define Wwalking (u.upropsWWALKING.extrinsic && \ 244. !Is_waterlevel(&u.uz)) 245. /* Don't get wet, can't go under water; overrides others except levitation */ 246. /* Wwalking is meaningless on water level */ 247. 248. #define HSwimming u.upropsSWIMMING.intrinsic 249. #define ESwimming u.upropsSWIMMING.extrinsic /* Tom */ 250. #ifdef STEED 251. # define Swimming (HSwimming || ESwimming || \ 252. is_swimmer(youmonst.data) || \ 253. (u.usteed && is_swimmer(u.usteed->data))) 254. #else 255. # define Swimming (HSwimming || ESwimming || \ 256. is_swimmer(youmonst.data)) 257. #endif 258. /* Get wet, don't go under water unless if amphibious */ 259. 260. #define HMagical_breathing u.upropsMAGICAL_BREATHING.intrinsic 261. #define EMagical_breathing u.upropsMAGICAL_BREATHING.extrinsic 262. #define Amphibious (HMagical_breathing || EMagical_breathing || \ 263. amphibious(youmonst.data)) 264. /* Get wet, may go under surface */ 265. 266. #define Breathless (HMagical_breathing || EMagical_breathing || \ 267. breathless(youmonst.data)) 268. 269. #define Underwater (u.uinwater) 270. /* Note that Underwater and u.uinwater are both used in code. 271. The latter form is for later implementation of other in-water 272. states, like swimming, wading, etc. */ 273. 274. #define HPasses_walls u.upropsPASSES_WALLS.intrinsic 275. #define EPasses_walls u.upropsPASSES_WALLS.extrinsic 276. #define Passes_walls (HPasses_walls || EPasses_walls || \ 277. passes_walls(youmonst.data)) 278. 279. 280. /*** Physical attributes ***/ 281. #define HSlow_digestion u.upropsSLOW_DIGESTION.intrinsic 282. #define ESlow_digestion u.upropsSLOW_DIGESTION.extrinsic 283. #define Slow_digestion (HSlow_digestion || ESlow_digestion) /* KMH */ 284. 285. #define HHalf_spell_damage u.upropsHALF_SPDAM.intrinsic 286. #define EHalf_spell_damage u.upropsHALF_SPDAM.extrinsic 287. #define Half_spell_damage (HHalf_spell_damage || EHalf_spell_damage) 288. 289. #define HHalf_physical_damage u.upropsHALF_PHDAM.intrinsic 290. #define EHalf_physical_damage u.upropsHALF_PHDAM.extrinsic 291. #define Half_physical_damage (HHalf_physical_damage || EHalf_physical_damage) 292. 293. #define HRegeneration u.upropsREGENERATION.intrinsic 294. #define ERegeneration u.upropsREGENERATION.extrinsic 295. #define Regeneration (HRegeneration || ERegeneration || \ 296. regenerates(youmonst.data)) 297. 298. #define HEnergy_regeneration u.upropsENERGY_REGENERATION.intrinsic 299. #define EEnergy_regeneration u.upropsENERGY_REGENERATION.extrinsic 300. #define Energy_regeneration (HEnergy_regeneration || EEnergy_regeneration) 301. 302. #define HProtection u.upropsPROTECTION.intrinsic 303. #define EProtection u.upropsPROTECTION.extrinsic 304. #define Protection (HProtection || EProtection) 305. 306. #define HProtection_from_shape_changers \ 307. u.upropsPROT_FROM_SHAPE_CHANGERS.intrinsic 308. #define EProtection_from_shape_changers \ 309. u.upropsPROT_FROM_SHAPE_CHANGERS.extrinsic 310. #define Protection_from_shape_changers \ 311. (HProtection_from_shape_changers || \ 312. EProtection_from_shape_changers) 313. 314. #define HPolymorph u.upropsPOLYMORPH.intrinsic 315. #define EPolymorph u.upropsPOLYMORPH.extrinsic 316. #define Polymorph (HPolymorph || EPolymorph) 317. 318. #define HPolymorph_control u.upropsPOLYMORPH_CONTROL.intrinsic 319. #define EPolymorph_control u.upropsPOLYMORPH_CONTROL.extrinsic 320. #define Polymorph_control (HPolymorph_control || EPolymorph_control) 321. 322. #define HUnchanging u.upropsUNCHANGING.intrinsic 323. #define EUnchanging u.upropsUNCHANGING.extrinsic 324. #define Unchanging (HUnchanging || EUnchanging) /* KMH */ 325. 326. #define HFast u.upropsFAST.intrinsic 327. #define EFast u.upropsFAST.extrinsic 328. #define Fast (HFast || EFast) 329. #define Very_fast ((HFast & ~INTRINSIC) || EFast) 330. 331. #define EReflecting u.upropsREFLECTING.extrinsic 332. #define Reflecting (EReflecting || \ 333. (youmonst.data &monsPM_SILVER_DRAGON)) 334. 335. #define Free_action u.upropsFREE_ACTION.extrinsic /* Tom */ 336. 337. #define Fixed_abil u.upropsFIXED_ABIL.extrinsic /* KMH */ 338. 339. #define Lifesaved u.upropsLIFESAVED.extrinsic 340. 341. 342. #endif /* YOUPROP_H */ youprop.h